package de.koller.altitude.engine.entity.player;

import de.koller.aframe.util.physics.Location;
import de.koller.altitude.ANode;
import de.koller.altitude.Altitude;
import de.koller.altitude.engine.entity.MovingObject;
import de.koller.oceanFramework.math.RVec3;
import de.koller.oceanFramework.util.GStat;

public class WalkingPlayer extends ANode implements IActivePlayerEntity {

	private final RVec3 eyeheight = new RVec3( 0, .8f, 0 );
	public final MovingObject mo = new MovingObject();
	public final WalkingPlayerSteering steering = new WalkingPlayerSteering( this );

	public final GStat walkspeed = new GStat();
	
	public WalkingPlayer() {
		mo.size.size.set( .4f, 1, .4f );
		this.walkspeed.joinAdd( "default", 1.5d );
		this.mo.physicsParameters.bindToFloor = true;
	}

	@Override
	protected void init() {
		super.init();
	
		mo.registerPhysics( Altitude.physics() );
		Altitude.input().mouseMotionHandlers.add( steering );
		Altitude.input().keyDownHandlers.add( steering );
	}
	
	@Override
	public Location getLocation() {
		return mo.location;
	}

	@Override
	public RVec3 getEyeHeight() {
		return eyeheight;
	}
	
}
